package com.lagou.service.impl;

import com.lagou.dao.IUserDao;
import com.lagou.service.IUserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserServiceImpl implements IUserService {

    private IUserDao userDao;

//     有参构造方法
  /*  public UserServiceImpl(IUserDao userDao){
        this.userDao = userDao;
    }
*/

    public void setUserDao(IUserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void save() {
//        调用dao层的save方法
//        ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
//        IUserDao userDao = (IUserDao)classPathXmlApplicationContext.getBean("userDao");
        userDao.save();
    }
}
